package com.vincce.fitness.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: long
 * Date: 9/24/13
 * Time: 3:15 PM
 * To change this template use File | Settings | File Templates.
 */
public class ChatMessage {

	/**
	 * 普通用户openid
	 */
	private String touser;

	/**
	 * 消息类型，支持文本（text）、图片（image）、语音（voice）、视频（video）
	 */
	private String msgtype;

	/**
	 * 文本消息
	 */
	private Text text;

    /**
     * 语音
     */
    private Voice voice;

	/**
	 * 圖文
	 */
	private News news;

    public static class Text {
		private String content;

		public String getContent() {
			return content;
		}

		public void setContent(String content) {
			this.content = content;
		}
	}

    public static class Voice {
        private String media_id;

        public String getMedia_id() {
            return media_id;
        }

        public void setMedia_id(String media_id) {
            this.media_id = media_id;
        }
    }

	public static class News {

		private List<Article> articles;

		public List<Article> getArticles() {
			return articles;
		}

		public void setArticles(List<Article> articles) {
			this.articles = articles;
		}

		public static class Article {
			private String title;
			private String description;
			private String url;
			private String picurl;

			public String getTitle() {
				return title;
			}

			public void setTitle(String title) {
				this.title = title;
			}

			public String getDescription() {
				return description;
			}

			public void setDescription(String description) {
				this.description = description;
			}

			public String getUrl() {
				return url;
			}

			public void setUrl(String url) {
				this.url = url;
			}

			public String getPicurl() {
				return picurl;
			}

			public void setPicurl(String picurl) {
				this.picurl = picurl;
			}
		}
	}

    public Voice getVoice() {
        return voice;
    }

    public void setVoice(Voice voice) {
        this.voice = voice;
    }

	public String getTouser() {
		return touser;
	}

	public void setTouser(String touser) {
		this.touser = touser;
	}

	public String getMsgtype() {
		return msgtype;
	}

	public void setMsgtype(String msgtype) {
		this.msgtype = msgtype;
	}

	public Text getText() {
		return text;
	}

	public void setText(Text text) {
		this.text = text;
	}

	public News getNews() {
		return news;
	}

	public void setNews(News news) {
		this.news = news;
	}

	public void addArticle(News.Article article) {
		if (news == null) {
			news = new News();
		}
		if (news.articles == null) {
			news.articles = new ArrayList<News.Article>();
		}
		news.articles.add(article);
	}
}
